// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.2.1

package ru.fizteh.fivt.JobProcessor;

public abstract class _ProcessorDisp extends Ice.ObjectImpl implements Processor
{
    protected void
    ice_copyStateFrom(Ice.Object __obj)
        throws java.lang.CloneNotSupportedException
    {
        throw new java.lang.CloneNotSupportedException();
    }

    public static final String[] __ids =
    {
        "::Ice::Object",
        "::JobProcessor::Processor"
    };

    public boolean
    ice_isA(String s)
    {
        return java.util.Arrays.binarySearch(__ids, s) >= 0;
    }

    public boolean
    ice_isA(String s, Ice.Current __current)
    {
        return java.util.Arrays.binarySearch(__ids, s) >= 0;
    }

    public String[]
    ice_ids()
    {
        return __ids;
    }

    public String[]
    ice_ids(Ice.Current __current)
    {
        return __ids;
    }

    public String
    ice_id()
    {
        return __ids[1];
    }

    public String
    ice_id(Ice.Current __current)
    {
        return __ids[1];
    }

    public static String
    ice_staticId()
    {
        return __ids[1];
    }

    public final void
    cancelJob(String id)
        throws UnknownJobIdException
    {
        cancelJob(id, null);
    }

    public final JobPrx
    getJob(Problem theProblem)
        throws TooManyJobsException
    {
        return getJob(theProblem, null);
    }

    public final JobInfo
    getJobInfo(String id)
        throws UnknownJobIdException
    {
        return getJobInfo(id, null);
    }

    public final Parameter[]
    getJobResult(String id)
        throws JobException,
               NotReadyException,
               UnknownJobIdException
    {
        return getJobResult(id, null);
    }

    public final String
    getJobStatus(String id)
        throws UnknownJobIdException
    {
        return getJobStatus(id, null);
    }

    public final java.util.Map<java.lang.String, JobInfo>
    getListOfJobs()
    {
        return getListOfJobs(null);
    }

    public final java.util.Map<java.lang.String, java.lang.String>
    getProperties()
    {
        return getProperties(null);
    }

    public final java.util.Map<java.lang.String, java.lang.String>
    getSliceChecksums()
    {
        return getSliceChecksums(null);
    }

    public final Parameter[]
    solve(Problem theProblem)
        throws JobException,
               TooManyJobsException
    {
        return solve(theProblem, null);
    }

    public final String
    submitProblem(String problemName, Parameter[] inParams)
        throws TooManyJobsException
    {
        return submitProblem(problemName, inParams, null);
    }

    public static IceInternal.DispatchStatus
    ___submitProblem(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        String problemName;
        problemName = __is.readString();
        Parameter[] inParams;
        inParams = ParametersHelper.read(__is);
        __is.readPendingObjects();
        try
        {
            String __ret = __obj.submitProblem(problemName, inParams, __current);
            __os.writeString(__ret);
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(TooManyJobsException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___getJobStatus(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Idempotent, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        String id;
        id = __is.readString();
        try
        {
            String __ret = __obj.getJobStatus(id, __current);
            __os.writeString(__ret);
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(UnknownJobIdException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___getJobResult(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        String id;
        id = __is.readString();
        try
        {
            Parameter[] __ret = __obj.getJobResult(id, __current);
            ParametersHelper.write(__os, __ret);
            __os.writePendingObjects();
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(JobException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
        catch(NotReadyException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
        catch(UnknownJobIdException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___cancelJob(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        String id;
        id = __is.readString();
        try
        {
            __obj.cancelJob(id, __current);
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(UnknownJobIdException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___solve(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        Problem theProblem;
        theProblem = new Problem();
        theProblem.__read(__is);
        __is.readPendingObjects();
        try
        {
            Parameter[] __ret = __obj.solve(theProblem, __current);
            ParametersHelper.write(__os, __ret);
            __os.writePendingObjects();
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(JobException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
        catch(TooManyJobsException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___getJobInfo(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Idempotent, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        String id;
        id = __is.readString();
        try
        {
            JobInfo __ret = __obj.getJobInfo(id, __current);
            __ret.__write(__os);
            __os.writePendingObjects();
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(UnknownJobIdException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___getListOfJobs(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Idempotent, __current.mode);
        IceInternal.BasicStream __os = __inS.os();
        java.util.Map<java.lang.String, JobInfo> __ret = __obj.getListOfJobs(__current);
        ListOfJobsHelper.write(__os, __ret);
        __os.writePendingObjects();
        return IceInternal.DispatchStatus.DispatchOK;
    }

    public static IceInternal.DispatchStatus
    ___getJob(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Normal, __current.mode);
        IceInternal.BasicStream __is = __inS.is();
        IceInternal.BasicStream __os = __inS.os();
        Problem theProblem;
        theProblem = new Problem();
        theProblem.__read(__is);
        __is.readPendingObjects();
        try
        {
            JobPrx __ret = __obj.getJob(theProblem, __current);
            JobPrxHelper.__write(__os, __ret);
            return IceInternal.DispatchStatus.DispatchOK;
        }
        catch(TooManyJobsException ex)
        {
            __os.writeUserException(ex);
            return IceInternal.DispatchStatus.DispatchUserException;
        }
    }

    public static IceInternal.DispatchStatus
    ___getSliceChecksums(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Idempotent, __current.mode);
        IceInternal.BasicStream __os = __inS.os();
        java.util.Map<java.lang.String, java.lang.String> __ret = __obj.getSliceChecksums(__current);
        Ice.SliceChecksumDictHelper.write(__os, __ret);
        return IceInternal.DispatchStatus.DispatchOK;
    }

    public static IceInternal.DispatchStatus
    ___getProperties(Processor __obj, IceInternal.Incoming __inS, Ice.Current __current)
    {
        __checkMode(Ice.OperationMode.Idempotent, __current.mode);
        IceInternal.BasicStream __os = __inS.os();
        java.util.Map<java.lang.String, java.lang.String> __ret = __obj.getProperties(__current);
        ProcessorPropertiesHelper.write(__os, __ret);
        return IceInternal.DispatchStatus.DispatchOK;
    }

    private final static String[] __all =
    {
        "cancelJob",
        "getJob",
        "getJobInfo",
        "getJobResult",
        "getJobStatus",
        "getListOfJobs",
        "getProperties",
        "getSliceChecksums",
        "ice_id",
        "ice_ids",
        "ice_isA",
        "ice_ping",
        "solve",
        "submitProblem"
    };

    public IceInternal.DispatchStatus
    __dispatch(IceInternal.Incoming in, Ice.Current __current)
    {
        int pos = java.util.Arrays.binarySearch(__all, __current.operation);
        if(pos < 0)
        {
            return IceInternal.DispatchStatus.DispatchOperationNotExist;
        }

        switch(pos)
        {
            case 0:
            {
                return ___cancelJob(this, in, __current);
            }
            case 1:
            {
                return ___getJob(this, in, __current);
            }
            case 2:
            {
                return ___getJobInfo(this, in, __current);
            }
            case 3:
            {
                return ___getJobResult(this, in, __current);
            }
            case 4:
            {
                return ___getJobStatus(this, in, __current);
            }
            case 5:
            {
                return ___getListOfJobs(this, in, __current);
            }
            case 6:
            {
                return ___getProperties(this, in, __current);
            }
            case 7:
            {
                return ___getSliceChecksums(this, in, __current);
            }
            case 8:
            {
                return ___ice_id(this, in, __current);
            }
            case 9:
            {
                return ___ice_ids(this, in, __current);
            }
            case 10:
            {
                return ___ice_isA(this, in, __current);
            }
            case 11:
            {
                return ___ice_ping(this, in, __current);
            }
            case 12:
            {
                return ___solve(this, in, __current);
            }
            case 13:
            {
                return ___submitProblem(this, in, __current);
            }
        }

        assert(false);
        return IceInternal.DispatchStatus.DispatchOperationNotExist;
    }

    public void
    __write(IceInternal.BasicStream __os)
    {
        __os.writeTypeId(ice_staticId());
        __os.startWriteSlice();
        __os.endWriteSlice();
        super.__write(__os);
    }

    public void
    __read(IceInternal.BasicStream __is, boolean __rid)
    {
        if(__rid)
        {
            __is.readTypeId();
        }
        __is.startReadSlice();
        __is.endReadSlice();
        super.__read(__is, true);
    }

    public void
    __write(Ice.OutputStream __outS)
    {
        Ice.MarshalException ex = new Ice.MarshalException();
        ex.reason = "type JobProcessor::Processor was not generated with stream support";
        throw ex;
    }

    public void
    __read(Ice.InputStream __inS, boolean __rid)
    {
        Ice.MarshalException ex = new Ice.MarshalException();
        ex.reason = "type JobProcessor::Processor was not generated with stream support";
        throw ex;
    }
}
